package com.example.chatchatbackend.entity.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@TableName("db_message")
@AllArgsConstructor
@NoArgsConstructor
public class Message {
    @TableId(type = IdType.AUTO)
    Integer id;
    Integer sendId;
    Integer toId;
    String message;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    LocalDateTime time;

    Integer isRespond;
    Integer isRobot;


    public Message(Integer id, int sendId, int toId, String message) {
        this.id = id;
        this.sendId = sendId;
        this.toId = toId;
        this.message = message;

    }

    public Message(Integer id, int sendId, int toId, String message, LocalDateTime time) {
        this.id = id;
        this.sendId = sendId;
        this.toId = toId;
        this.message = message;
        this.time = time;
    }
}
